package com.twu.biblioteca.model;

/**
 * Created by davecroman on 19/09/2014.
 */
public abstract class BorrowableAsset {

    private UserAccount borrower;

    public void borrow(UserAccount accountOfBorrower){
        this.borrower = accountOfBorrower;
        accountOfBorrower.addToBorrowedItems(this);
    }

    public boolean isAvailable(){
        return borrower == null;
    }

    public void returnBack(){
        borrower.removeFromBorrowedItems(this);
        this.borrower = null;
    }

    public UserAccount getBorrower() {
        return borrower;
    }

    @Override
    public abstract String toString();
}
